package javacommon.util;

import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class PropertiesUtil {
	public static java.util.Properties pps;
	private static ResourceBundle bundle;
	
	/*public PropertiesUtil(){
		try{
			
			String path = (getClass().getClassLoader().getResource("").toURI()).getPath();
			FileInputStream fis = new FileInputStream(path + "application.properties");
			pps.load(fis);
			//PropertiesConfiguration config = new PropertiesConfiguration("config.properties");
		}catch (Exception e){
			e.printStackTrace();
		}
	}*/
	public static String getString(String s){
        String s1 = null;
        try{
            s1 = getResourceBundle().getString(s);
        }catch(MissingResourceException missingresourceexception){
            System.out.println("ConfigBundle:getString error!"+missingresourceexception.toString());
        }
        return s1;
    }
	public static ResourceBundle getResourceBundle(){
        if(bundle == null)
            bundle = ResourceBundle.getBundle("application", Locale.getDefault());
        return bundle;
    }
	 
	
	public static void main(String[] args){
		//pps = new Properties();
		//System.out.println(PropertiesUtil.pps.getProperty("allowUploadPath"));
		System.out.println(PropertiesUtil.getResourceBundle().getString("name"));
	}
}
